{% load core_tags %}
{% if request %}
{% with tasks=request.tasks.all %}
    {% if tasks.count > 1 %}
        <table class="table table-bordered">
            <tr>
                <th>Request History</th>
            </tr>
            {% for task in tasks %}
            {% with activity=task.activity %}
                {% if activity %}
                    <tr data-toggle="collapse" data-target="#{{activity.code}}" class="active">
                        <td>
                            <div class="row">
                              <div class="col-md-8"><span class=" glyphicon glyphicon glyphicon-plus"> </span> <strong>{{activity.title}}</strong> - <small>{{task.assignee.name}}</small></div>
                              <div class="col-md-4 text-right"><small>{{activity.last_updated}}</small></div>
                            </div>
                        </td>
                    </tr>
                    <tr id="{{activity.code}}" class="collapse">
                        <td>
                            {% include "core/widgets/readonly.html" with object=activity %}
                        </td>
                    </tr>
                {% endif %}
            {% endwith %}
            {% endfor %}
        </table>
    {% endif %}
{% endwith %}
{% endif %}
